<template>
  <div class="app-header-sticky" v-if="isShow">
    <div class="container">
      <router-link class="logo" to="/" />
      <!-- <div class="right">
        <router-link to="/">首页</router-link>
        <router-link to="/" v-for="item in navData" :key="item.id">{{
          item.name
        }}</router-link>
      </div> -->
      <appHeaderNav></appHeaderNav>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'

import appHeaderNav from './app-header-nav.vue'
const isShow = ref(false)
// 设置导航栏数据

window.onscroll = () => {
  const scrolltop = document.documentElement.scrollTop
  if (TOP < scrolltop) {
    isShow.value = true
  } else {
    isShow.value = false
  }
}

const TOP = 120
</script>
<style lang="scss" scoped>
// 吸顶容器
.app-header-sticky {
  width: 100%;
  height: 80px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 999;
  background-color: #fff;
  border-bottom: 1px solid #e4e4e4;
  // 模板无动画
  // transform: translateY(-100%);
  // opacity: 0;
  &.show {
    transition: all 0.3s linear;
    transform: none;
    opacity: 1;
  }
  .container {
    display: flex;
    align-items: center;
  }
  .logo {
    width: 200px;
    height: 80px;
    background: url(../assets/images/logo.png) no-repeat right 2px;
    background-size: 160px auto;
  }
  .right {
    width: 220px;
    display: flex;
    text-align: center;
    padding-left: 40px;
    border-left: 2px solid $xtxColor;
    a {
      width: 38px;
      margin-right: 40px;
      font-size: 16px;
      line-height: 1;
      &:hover {
        color: $xtxColor;
      }
    }
  }
}

// 吸顶容器结束
.main {
  min-height: 600px;
}
</style>
